#include<iostream>
using namespace std;
void get_next(char t[], int next[])
{
	int k = -1;
	int j = 0;
	next[0] = -1;
	int len = strlen(t) - 1;
	while(t[j]!='\0')
	{
		if (k == -1 || t[j] == t[k])
		{
			j++;
			k++;
			next[j] = k;
		}
		else
		{
			k = next[k];
		}
	}
}
int main()
{
	char s[30], t[30];
	fgets(s, 30, stdin);
	fgets(t, 30, stdin);
	int len1 = strlen(s) - 1;
	int len2 = strlen(t) - 1;
	int next[30];
	get_next(t, next);
    int i = 0, j = 0;
	/*for (i = 0; i < len1; i++)
	{
		for (j = 0; j < len2; j++)
		{
			if (j == -1 || s[i] == t[j])
			{
				i++;
				j++;
			}
			else
			{
				j = next[j];
			}
		}
	}*/
	while (i < len1 && j < len2)
	{
		if (j == -1 || s[i] == t[j])
		{
			i++;
			j++;
		}
		else
		{
			j = next[j];
		}
	}
	if (j == len2)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}